{% macro load_file(filename) %}{% include filename %}{%- endmacro -%}
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: fasjson
  labels:
    app: fasjson
    build: fasjson
spec:
  runPolicy: Serial
  source:
    type: Dockerfile
    dockerfile: |-
      {{ load_file('Dockerfile') | indent(6) }}
  strategy:
    type: Docker
    dockerStrategy:
      # Prevent Docker from caching the git clone step in the Dockerfile
      noCache: true
  output:
    to:
      kind: ImageStreamTag
      name: fasjson:latest
  triggers:
  - type: ConfigChange
  - type: ImageChange
{% if fasjson_stg_github_secret is defined and env == 'staging' %}
  - type: GitHub
    github:
      secret: "{{ fasjson_stg_github_secret }}"
{% elif fasjson_github_secret is defined and env == 'production' %}
  # Do we really want auto rebuilds in prod?
  # - type: GitHub
  #   github:
  #     secret: "{{ fasjson_github_secret }}"
{% endif %}
